package com.sgcc.fj.pmos.common.utils;

import android.app.Application;

import com.sgcc.fj.pmos.mobileapp.app.BaseAppIniter;


public class Options {
    private Options() {
    }
    Application application;
    private static Options instance = new Options();
    OnPlaceCallBackListener onPlaceCallBackListener;

    public interface OnPlaceCallBackListener {
        void callback(String palce);
    }

    public static Options getInstance() {

        return instance;
    }

    public void setOnPlaceCallBackListener(OnPlaceCallBackListener onPlaceCallBackListener) {
        this.onPlaceCallBackListener = onPlaceCallBackListener;
    }

    public OnPlaceCallBackListener getOnPlaceCallBackListener() {

        return onPlaceCallBackListener;
    }


    public void init(Application application) {
        this.application = application;
        beforeUserAgreement();
        if (!isUserAgreement())
            return;
        afterUserAgreement();
    }

    /**
     * 用户同意用户之前调用，只做最基本的初始化，不能涉及任何敏感内容
     */
    private void beforeUserAgreement() {
        BaseAppIniter.initBeforeUserAgreement(application);
    }

    /**
     * 用户同意用户之后调用
     */
    public void afterUserAgreement() {
        BaseAppIniter.initAfterUserAgreement(application);
    }

    /**
     * 用户是否同意了隐私协议
     *
     * @return
     */
    protected boolean isUserAgreement() {
        return BaseAppIniter.isUserAgreement();
    }
}
